package cn.ztuo.bitrade.dao;

import cn.ztuo.bitrade.entity.ContractBond;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.querydsl.QueryDslPredicateExecutor;

import java.math.BigDecimal;
import java.util.List;

public interface ContractBondMapper extends JpaRepository<ContractBond, String>, JpaSpecificationExecutor<ContractBond>, QueryDslPredicateExecutor<ContractBond> {

    @Query(nativeQuery=true,value="select * from contract_bond c where  c.symbol= ?1 and c.location_value > ?2 ORDER BY location_value DESC ")
    List<ContractBond> findByContractBond(String symbol, BigDecimal getlocationvalue);

    List<ContractBond> findBySymbol(String symbol, Sort sort);

    ContractBond findBySymbolAndMultiple(String symbol, BigDecimal lever);

    ContractBond findById(Long id);
}
